<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#222" media="(prefers-color-scheme: dark)"><meta name="generator" content="Hexo 7.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" integrity="sha256-dABdfBfUoC8vJUBOwGVdm8L9qlMWaHTIfXt+7GnZCIo=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/black/pace-theme-flat-top.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous" defer></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"tryhub.top","root":"/","images":"/images","scheme":"Gemini","darkmode":true,"version":"8.23.0","exturl":false,"sidebar":{"position":"left","width_expanded":320,"width_dual_column":240,"display":"post","padding":18,"offset":12},"hljswrap":true,"copycode":{"enable":true,"style":"mac"},"fold":{"enable":false,"height":500},"bookmark":{"enable":true,"color":"#222","save":"manual"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"duration":200,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.json","localsearch":{"enable":true,"top_n_per_article":1,"unescape":true,"preload":true,"trigger":"auto"}}</script><script src="/js/config.js" defer></script>

    <meta name="description" content="使用wget 下载elasticsearch安装包1wget https:&#x2F;&#x2F;artifacts.elastic.co&#x2F;downloads&#x2F;elasticsearch&#x2F;elasticsearch-5.6.13.tar.gz 解压1tar -zxvf elasticsearch-5.6.13.tar.gz">
<meta property="og:type" content="article">
<meta property="og:title" content="阿里云服务器 快速安装ElasticSearch">
<meta property="og:url" content="https://tryhub.top/2018/12/14/%E9%98%BF%E9%87%8C%E4%BA%91%E6%9C%8D%E5%8A%A1%E5%99%A8-%E5%BF%AB%E9%80%9F%E5%AE%89%E8%A3%85ElasticSearch/index.html">
<meta property="og:site_name" content="奇姆的博客">
<meta property="og:description" content="使用wget 下载elasticsearch安装包1wget https:&#x2F;&#x2F;artifacts.elastic.co&#x2F;downloads&#x2F;elasticsearch&#x2F;elasticsearch-5.6.13.tar.gz 解压1tar -zxvf elasticsearch-5.6.13.tar.gz">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2018-12-14T02:56:48.000Z">
<meta property="article:modified_time" content="2023-07-07T07:27:41.421Z">
<meta property="article:author" content="Jaron Chim">
<meta property="article:tag" content="linux">
<meta property="article:tag" content="wget">
<meta property="article:tag" content="elasticsearch">
<meta name="twitter:card" content="summary">


<link rel="canonical" href="https://tryhub.top/2018/12/14/%E9%98%BF%E9%87%8C%E4%BA%91%E6%9C%8D%E5%8A%A1%E5%99%A8-%E5%BF%AB%E9%80%9F%E5%AE%89%E8%A3%85ElasticSearch/">


<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://tryhub.top/2018/12/14/%E9%98%BF%E9%87%8C%E4%BA%91%E6%9C%8D%E5%8A%A1%E5%99%A8-%E5%BF%AB%E9%80%9F%E5%AE%89%E8%A3%85ElasticSearch/","path":"2018/12/14/阿里云服务器-快速安装ElasticSearch/","title":"阿里云服务器 快速安装ElasticSearch"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>阿里云服务器 快速安装ElasticSearch | 奇姆的博客</title>
  

  <script src="/js/third-party/analytics/baidu-analytics.js" defer></script>
  <script async src="https://hm.baidu.com/hm.js?1ad13b7aff8bfe9206fa7e12d5c4a4f0"></script>







  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous" defer></script>
<script src="/js/utils.js" defer></script><script src="/js/motion.js" defer></script><script src="/js/sidebar.js" defer></script><script src="/js/next-boot.js" defer></script><script src="/js/bookmark.js" defer></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous" defer></script>
<script src="/js/third-party/search/local-search.js" defer></script>





  <script src="/js/third-party/pace.js" defer></script>


  
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>





  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<link rel="alternate" href="/atom.xml" title="奇姆的博客" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">奇姆的博客</p>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li><li class="menu-item menu-item-sitemap"><a href="/sitemap.xml" rel="section"><i class="fa fa-sitemap fa-fw"></i>站点地图</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
      <div class="search-header">
        <span class="search-icon">
          <i class="fa fa-search"></i>
        </span>
        <div class="search-input-container">
          <input autocomplete="off" autocapitalize="off" maxlength="80"
                placeholder="搜索..." spellcheck="false"
                type="search" class="search-input">
        </div>
        <span class="popup-btn-close" role="button">
          <i class="fa fa-times-circle"></i>
        </span>
      </div>
      <div class="search-result-container">
        <div class="search-result-icon">
          <i class="fa fa-spinner fa-pulse fa-5x"></i>
        </div>
      </div>
    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BD%BF%E7%94%A8wget-%E4%B8%8B%E8%BD%BDelasticsearch%E5%AE%89%E8%A3%85%E5%8C%85"><span class="nav-number">1.</span> <span class="nav-text">使用wget 下载elasticsearch安装包</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%A7%A3%E5%8E%8B"><span class="nav-number">2.</span> <span class="nav-text">解压</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%A4%96%E7%BD%91%E8%AE%BF%E9%97%AE%E9%85%8D%E7%BD%AE"><span class="nav-number">3.</span> <span class="nav-text">外网访问配置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%B8%B8%E8%A7%81%E9%85%8D%E7%BD%AE%E9%97%AE%E9%A2%98%E8%B5%84%E6%96%99"><span class="nav-number">4.</span> <span class="nav-text">常见配置问题资料</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%AD%A4%E7%89%88%E6%9C%AC%E9%85%8D%E5%90%88-spring-boot-%E5%AF%B9%E5%BA%94%E7%89%88%E6%9C%AC-2-0-7-RELEASE-%E4%BD%BF%E7%94%A8"><span class="nav-number">5.</span> <span class="nav-text">此版本配合 spring-boot 对应版本 2.0.7.RELEASE 使用</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#spring-boot-%E4%BD%BF%E7%94%A8%E4%BE%9D%E8%B5%96"><span class="nav-number">5.1.</span> <span class="nav-text">spring-boot 使用依赖</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#IK%E4%B8%AD%E6%96%87%E5%88%86%E8%AF%8DGitHub%E4%B8%8B%E8%BD%BD%E7%BD%91%E7%AB%99"><span class="nav-number">6.</span> <span class="nav-text">IK中文分词GitHub下载网站</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%89%88%E6%9C%AC%E6%9F%A5%E7%9C%8B"><span class="nav-number">6.1.</span> <span class="nav-text">版本查看</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BD%BF%E7%94%A8wget-%E4%B8%8B%E8%BD%BDIK%E4%B8%AD%E6%96%87%E5%88%86%E8%AF%8D%E5%99%A8"><span class="nav-number">6.2.</span> <span class="nav-text">使用wget 下载IK中文分词器</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E8%A7%A3%E5%8E%8B-1"><span class="nav-number">6.3.</span> <span class="nav-text">解压</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%88%A0%E9%99%A4%E5%8E%8B%E7%BC%A9%E5%8C%85"><span class="nav-number">6.4.</span> <span class="nav-text">删除压缩包</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%BD%93%E6%88%91%E4%BB%AC%E5%9C%A8%E4%BD%BF%E7%94%A8elasticsearch%E7%9A%84%E6%97%B6%E5%80%99%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%98%AF%E4%BB%A5root%E6%9D%83%E9%99%90%E6%9D%A5%E6%89%A7%E8%A1%8Celasticsearch"><span class="nav-number">7.</span> <span class="nav-text">当我们在使用elasticsearch的时候，如果是以root权限来执行elasticsearch</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%88%99%E4%BC%9A%E6%9C%89%E4%BB%A5%E4%B8%8B%E6%8A%A5%E9%94%99"><span class="nav-number">8.</span> <span class="nav-text">则会有以下报错</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%88%9B%E5%BB%BAelsearch%E7%94%A8%E6%88%B7%E7%BB%84%E5%8F%8Aelsearch%E7%94%A8%E6%88%B7"><span class="nav-number">9.</span> <span class="nav-text">创建elsearch用户组及elsearch用户</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%9B%B4%E6%94%B9elasticsearch%E6%96%87%E4%BB%B6%E5%A4%B9%E5%8F%8A%E5%86%85%E9%83%A8%E6%96%87%E4%BB%B6%E7%9A%84%E6%89%80%E5%B1%9E%E7%94%A8%E6%88%B7%E5%8F%8A%E7%BB%84%E4%B8%BAelsearch-elsearch"><span class="nav-number">10.</span> <span class="nav-text">更改elasticsearch文件夹及内部文件的所属用户及组为elsearch:elsearch</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%88%87%E6%8D%A2%E5%88%B0elsearch%E7%94%A8%E6%88%B7%E5%86%8D%E5%90%AF%E5%8A%A8"><span class="nav-number">11.</span> <span class="nav-text">切换到elsearch用户再启动</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%90%AF%E5%8A%A8%E5%90%8E%E4%BC%9A%E6%89%93%E5%8D%B0%E6%AD%A3%E5%B8%B8%E5%90%AF%E5%8A%A8%E6%97%A5%E5%BF%97%E4%BF%A1%E6%81%AF%E5%A6%82%E4%B8%8B"><span class="nav-number">12.</span> <span class="nav-text">启动后会打印正常启动日志信息如下</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#ElasticSearch%E5%90%8E%E5%8F%B0%E5%90%AF%E5%8A%A8%E5%91%BD%E4%BB%A4"><span class="nav-number">13.</span> <span class="nav-text">ElasticSearch后台启动命令</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%B8%B8%E8%A7%81%E5%BC%82%E5%B8%B8"><span class="nav-number">14.</span> <span class="nav-text">常见异常</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#max-file-descriptors-65535-for-elasticsearchprocess-is-too-low-increase-to-at-least-65536"><span class="nav-number">14.1.</span> <span class="nav-text">max file descriptors [65535] for elasticsearchprocess is too low, increase to at least [65536]</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#max-virtual-memory-areas-vm-max-map-count-65530-is-too-low-increase-to-at-least-262144"><span class="nav-number">14.2.</span> <span class="nav-text">max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Jaron Chim"
      src="/images/jaron.gif">
  <p class="site-author-name" itemprop="name">Jaron Chim</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">76</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">95</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">144</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/admin-Jaron" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;admin-Jaron" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:tryhub@tryhub.top" title="E-Mail → mailto:tryhub@tryhub.top" rel="noopener me"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
  </div>

        </div>
      </div>
        <div class="back-to-top animated" role="button" aria-label="返回顶部">
          <i class="fa fa-arrow-up"></i>
          <span>0%</span>
        </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://tryhub.top/2018/12/14/%E9%98%BF%E9%87%8C%E4%BA%91%E6%9C%8D%E5%8A%A1%E5%99%A8-%E5%BF%AB%E9%80%9F%E5%AE%89%E8%A3%85ElasticSearch/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/jaron.gif">
      <meta itemprop="name" content="Jaron Chim">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="奇姆的博客">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="阿里云服务器 快速安装ElasticSearch | 奇姆的博客">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          阿里云服务器 快速安装ElasticSearch
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2018-12-14 10:56:48" itemprop="dateCreated datePublished" datetime="2018-12-14T10:56:48+08:00">2018-12-14</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">更新于</span>
      <time title="修改时间：2023-07-07 15:27:41" itemprop="dateModified" datetime="2023-07-07T15:27:41+08:00">2023-07-07</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/linux/" itemprop="url" rel="index"><span itemprop="name">linux</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/linux/elasticsearch/" itemprop="url" rel="index"><span itemprop="name">elasticsearch</span></a>
        </span>
    </span>

  
    <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <span id="busuanzi_value_page_pv"></span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><h2 id="使用wget-下载elasticsearch安装包"><a href="#使用wget-下载elasticsearch安装包" class="headerlink" title="使用wget 下载elasticsearch安装包"></a>使用wget 下载elasticsearch安装包</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.13.tar.gz</span><br></pre></td></tr></table></figure>
<h2 id="解压"><a href="#解压" class="headerlink" title="解压"></a>解压</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tar -zxvf elasticsearch-5.6.13.tar.gz</span><br></pre></td></tr></table></figure>

<span id="more"></span>

<h2 id="外网访问配置"><a href="#外网访问配置" class="headerlink" title="外网访问配置"></a>外网访问配置</h2><p><code>config</code>目录下面<code>elasticsearch.yml</code><br>修改为 <code>network.host: 0.0.0.0</code></p>
<h2 id="常见配置问题资料"><a href="#常见配置问题资料" class="headerlink" title="常见配置问题资料"></a><a target="_blank" rel="noopener" href="https://www.jianshu.com/p/c5d6ec0f35e0">常见配置问题资料</a></h2><h2 id="此版本配合-spring-boot-对应版本-2-0-7-RELEASE-使用"><a href="#此版本配合-spring-boot-对应版本-2-0-7-RELEASE-使用" class="headerlink" title="此版本配合 spring-boot 对应版本 2.0.7.RELEASE 使用"></a>此版本配合 spring-boot 对应版本 2.0.7.RELEASE 使用</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">&lt;parent&gt;</span><br><span class="line">    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;</span><br><span class="line">    &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;</span><br><span class="line">    &lt;version&gt;2.0.7.RELEASE&lt;/version&gt;</span><br><span class="line">    &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;</span><br><span class="line">&lt;/parent&gt;</span><br></pre></td></tr></table></figure>

<h3 id="spring-boot-使用依赖"><a href="#spring-boot-使用依赖" class="headerlink" title="spring-boot 使用依赖"></a>spring-boot 使用依赖</h3><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">dependency</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.boot<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-boot-starter-data-elasticsearch<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure>

<h2 id="IK中文分词GitHub下载网站"><a href="#IK中文分词GitHub下载网站" class="headerlink" title="IK中文分词GitHub下载网站"></a>IK中文分词<a target="_blank" rel="noopener" href="https://github.com/medcl/elasticsearch-analysis-ik/releases">GitHub下载网站</a></h2><h3 id="版本查看"><a href="#版本查看" class="headerlink" title="版本查看"></a><a target="_blank" rel="noopener" href="https://github.com/medcl/elasticsearch-analysis-ik/blob/master/README.md">版本查看</a></h3><h3 id="使用wget-下载IK中文分词器"><a href="#使用wget-下载IK中文分词器" class="headerlink" title="使用wget 下载IK中文分词器"></a>使用wget 下载IK中文分词器</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.6.13/elasticsearch-analysis-ik-5.6.13.zip</span><br></pre></td></tr></table></figure>

<p>插件下载到ES根目录下的<code>plugins</code>文件夹中 : <code>./elasticsearch-5.6.13/plugins/</code></p>
<h3 id="解压-1"><a href="#解压-1" class="headerlink" title="解压"></a>解压</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">unzip elasticsearch-analysis-ik-5.6.13.zip</span><br></pre></td></tr></table></figure>
<h3 id="删除压缩包"><a href="#删除压缩包" class="headerlink" title="删除压缩包"></a>删除压缩包</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rm elasticsearch-analysis-ik-5.6.13.zip</span><br></pre></td></tr></table></figure>

<h2 id="当我们在使用elasticsearch的时候，如果是以root权限来执行elasticsearch"><a href="#当我们在使用elasticsearch的时候，如果是以root权限来执行elasticsearch" class="headerlink" title="当我们在使用elasticsearch的时候，如果是以root权限来执行elasticsearch"></a>当我们在使用elasticsearch的时候，如果是以root权限来执行elasticsearch</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./elasticsearch</span><br></pre></td></tr></table></figure>

<!-- more -->

<h2 id="则会有以下报错"><a href="#则会有以下报错" class="headerlink" title="则会有以下报错"></a>则会有以下报错</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">[2018-12-04T10:24:21,751][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]</span><br><span class="line">org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root</span><br><span class="line">        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-6.2.2.jar:6.2.2]</span><br><span class="line">        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-6.2.2.jar:6.2.2]</span><br><span class="line">        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.2.2.jar:6.2.2]</span><br><span class="line">        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.2.2.jar:6.2.2]</span><br><span class="line">        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.2.2.jar:6.2.2]</span><br><span class="line">        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-6.2.2.jar:6.2.2]</span><br><span class="line">        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) ~[elasticsearch-6.2.2.jar:6.2.2]</span><br><span class="line">Caused by: java.lang.RuntimeException: can not run elasticsearch as root</span><br><span class="line">        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:105) ~[elasticsearch-6.2.2.jar:6.2.2]</span><br><span class="line">        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:172) ~[elasticsearch-6.2.2.jar:6.2.2]</span><br><span class="line">        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:323) ~[elasticsearch-6.2.2.jar:6.2.2]</span><br><span class="line">        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.2.2.jar:6.2.2]</span><br></pre></td></tr></table></figure>

<p>这是出于系统安全考虑设置的条件。由于ElasticSearch可以接收用户输入的脚本并且执行，为了系统安全考虑，<br>建议创建一个单独的用户用来运行ElasticSearch</p>
<h2 id="创建elsearch用户组及elsearch用户"><a href="#创建elsearch用户组及elsearch用户" class="headerlink" title="创建elsearch用户组及elsearch用户"></a>创建elsearch用户组及elsearch用户</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">groupadd elsearch</span><br><span class="line">useradd elsearch -g elsearch -p elasticsearch</span><br></pre></td></tr></table></figure>

<h2 id="更改elasticsearch文件夹及内部文件的所属用户及组为elsearch-elsearch"><a href="#更改elasticsearch文件夹及内部文件的所属用户及组为elsearch-elsearch" class="headerlink" title="更改elasticsearch文件夹及内部文件的所属用户及组为elsearch:elsearch"></a>更改elasticsearch文件夹及内部文件的所属用户及组为elsearch:elsearch</h2><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">chown</span> -R elsearch:elsearch <span class="variable">$&#123;elasticsearch&#125;</span></span><br></pre></td></tr></table></figure>

<p>${elasticsearch}为你elasticsearch的目录路径</p>
<h2 id="切换到elsearch用户再启动"><a href="#切换到elsearch用户再启动" class="headerlink" title="切换到elsearch用户再启动"></a>切换到elsearch用户再启动</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">su elsearch #切换账户</span><br><span class="line">cd elasticsearch/bin #进入你的elasticsearch目录下的bin目录</span><br><span class="line">./elasticsearch</span><br></pre></td></tr></table></figure>

<h2 id="启动后会打印正常启动日志信息如下"><a href="#启动后会打印正常启动日志信息如下" class="headerlink" title="启动后会打印正常启动日志信息如下"></a>启动后会打印正常启动日志信息如下</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line">[2018-12-04T10:48:10,218][INFO ][o.e.n.Node               ] [] initializing ...</span><br><span class="line">[2018-12-04T10:48:10,387][INFO ][o.e.e.NodeEnvironment    ] [5tOgySS] using [1] data paths, mounts [[/ (/dev/vda1)]], net usable_space [34.2gb], net total_space [39.2gb], types [ext4]</span><br><span class="line">[2018-12-04T10:48:10,387][INFO ][o.e.e.NodeEnvironment    ] [5tOgySS] heap size [990.7mb], compressed ordinary object pointers [true]</span><br><span class="line">[2018-12-04T10:48:10,388][INFO ][o.e.n.Node               ] node name [5tOgySS] derived from node ID [5tOgySSsTVyh-aqzPrZrZQ]; set [node.name] to override</span><br><span class="line">[2018-12-04T10:48:10,389][INFO ][o.e.n.Node               ] version[6.2.2], pid[2211], build[10b1edd/2018-02-16T19:01:30.685723Z], OS[Linux/4.4.0-117-generic/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_191/25.191-b12]</span><br><span class="line">[2018-12-04T10:48:10,389][INFO ][o.e.n.Node               ] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch.UJf6TjBC, -XX:+HeapDumpOnOutOfMemoryError, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Des.path.home=/usr/local/lib/elasticsearch-6.2.2, -Des.path.conf=/usr/local/lib/elasticsearch-6.2.2/config]</span><br><span class="line">[2018-12-04T10:48:11,432][INFO ][o.e.p.PluginsService     ] [5tOgySS] loaded module [aggs-matrix-stats]</span><br><span class="line">[2018-12-04T10:48:11,432][INFO ][o.e.p.PluginsService     ] [5tOgySS] loaded module [analysis-common]</span><br><span class="line">[2018-12-04T10:48:11,433][INFO ][o.e.p.PluginsService     ] [5tOgySS] loaded module [ingest-common]</span><br><span class="line">[2018-12-04T10:48:11,433][INFO ][o.e.p.PluginsService     ] [5tOgySS] loaded module [lang-expression]</span><br><span class="line">[2018-12-04T10:48:11,433][INFO ][o.e.p.PluginsService     ] [5tOgySS] loaded module [lang-mustache]</span><br><span class="line">[2018-12-04T10:48:11,433][INFO ][o.e.p.PluginsService     ] [5tOgySS] loaded module [lang-painless]</span><br><span class="line">[2018-12-04T10:48:11,433][INFO ][o.e.p.PluginsService     ] [5tOgySS] loaded module [mapper-extras]</span><br><span class="line">[2018-12-04T10:48:11,433][INFO ][o.e.p.PluginsService     ] [5tOgySS] loaded module [parent-join]</span><br><span class="line">[2018-12-04T10:48:11,434][INFO ][o.e.p.PluginsService     ] [5tOgySS] loaded module [percolator]</span><br><span class="line">[2018-12-04T10:48:11,434][INFO ][o.e.p.PluginsService     ] [5tOgySS] loaded module [rank-eval]</span><br><span class="line">[2018-12-04T10:48:11,434][INFO ][o.e.p.PluginsService     ] [5tOgySS] loaded module [reindex]</span><br><span class="line">[2018-12-04T10:48:11,434][INFO ][o.e.p.PluginsService     ] [5tOgySS] loaded module [repository-url]</span><br><span class="line">[2018-12-04T10:48:11,434][INFO ][o.e.p.PluginsService     ] [5tOgySS] loaded module [transport-netty4]</span><br><span class="line">[2018-12-04T10:48:11,434][INFO ][o.e.p.PluginsService     ] [5tOgySS] loaded module [tribe]</span><br><span class="line">[2018-12-04T10:48:11,435][INFO ][o.e.p.PluginsService     ] [5tOgySS] no plugins loaded</span><br><span class="line">[2018-12-04T10:48:14,742][INFO ][o.e.d.DiscoveryModule    ] [5tOgySS] using discovery type [zen]</span><br><span class="line">[2018-12-04T10:48:15,172][INFO ][o.e.n.Node               ] initialized</span><br><span class="line">[2018-12-04T10:48:15,172][INFO ][o.e.n.Node               ] [5tOgySS] starting ...</span><br><span class="line">[2018-12-04T10:48:15,356][INFO ][o.e.t.TransportService   ] [5tOgySS] publish_address &#123;127.0.0.1:9300&#125;, bound_addresses &#123;127.0.0.1:9300&#125;</span><br><span class="line">[2018-12-04T10:48:15,365][WARN ][o.e.b.BootstrapChecks    ] [5tOgySS] max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]</span><br><span class="line">[2018-12-04T10:48:15,365][WARN ][o.e.b.BootstrapChecks    ] [5tOgySS] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]</span><br><span class="line">[2018-12-04T10:48:18,413][INFO ][o.e.c.s.MasterService    ] [5tOgySS] zen-disco-elected-as-master ([0] nodes joined), reason: new_master &#123;5tOgySS&#125;&#123;5tOgySSsTVyh-aqzPrZrZQ&#125;&#123;2do4g-5VQhqH_uTYtm9Paw&#125;&#123;127.0.0.1&#125;&#123;127.0.0.1:9300&#125;</span><br><span class="line">[2018-12-04T10:48:18,417][INFO ][o.e.c.s.ClusterApplierService] [5tOgySS] new_master &#123;5tOgySS&#125;&#123;5tOgySSsTVyh-aqzPrZrZQ&#125;&#123;2do4g-5VQhqH_uTYtm9Paw&#125;&#123;127.0.0.1&#125;&#123;127.0.0.1:9300&#125;, reason: apply cluster state (from master [master &#123;5tOgySS&#125;&#123;5tOgySSsTVyh-aqzPrZrZQ&#125;&#123;2do4g-5VQhqH_uTYtm9Paw&#125;&#123;127.0.0.1&#125;&#123;127.0.0.1:9300&#125; committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])</span><br><span class="line">[2018-12-04T10:48:18,526][INFO ][o.e.h.n.Netty4HttpServerTransport] [5tOgySS] publish_address &#123;127.0.0.1:9200&#125;, bound_addresses &#123;127.0.0.1:9200&#125;</span><br><span class="line">[2018-12-04T10:48:18,526][INFO ][o.e.n.Node               ] [5tOgySS] started</span><br><span class="line">[2018-12-04T10:48:18,534][INFO ][o.e.g.GatewayService     ] [5tOgySS] recovered [0] indices into cluster_state</span><br></pre></td></tr></table></figure>

<h2 id="ElasticSearch后台启动命令"><a href="#ElasticSearch后台启动命令" class="headerlink" title="ElasticSearch后台启动命令"></a>ElasticSearch后台启动命令</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./elasticsearch -d</span><br></pre></td></tr></table></figure>

<h2 id="常见异常"><a href="#常见异常" class="headerlink" title="常见异常"></a>常见异常</h2><h3 id="max-file-descriptors-65535-for-elasticsearchprocess-is-too-low-increase-to-at-least-65536"><a href="#max-file-descriptors-65535-for-elasticsearchprocess-is-too-low-increase-to-at-least-65536" class="headerlink" title="max file descriptors [65535] for elasticsearchprocess is too low, increase to at least [65536]"></a>max file descriptors [65535] for elasticsearchprocess is too low, increase to at least [65536]</h3><p>修改 <code>/etc/security/limits.conf</code> 添加如下内容(建议新增到最下面)</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">* - nofile 65536</span><br><span class="line">* - memlock unlimited</span><br></pre></td></tr></table></figure>

<h3 id="max-virtual-memory-areas-vm-max-map-count-65530-is-too-low-increase-to-at-least-262144"><a href="#max-virtual-memory-areas-vm-max-map-count-65530-is-too-low-increase-to-at-least-262144" class="headerlink" title="max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]"></a>max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]</h3><p>修改 <code>/etc/sysctl.conf</code> 添加如下内容(建议新增到最下面)</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vm.max_map_count = 262144</span><br></pre></td></tr></table></figure>

<p>修改完内核参数立即生效</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo sysctl -p</span><br></pre></td></tr></table></figure>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="reward-container">
  <div>请我一杯咖啡吧！</div>
  <button>
    赞赏
  </button>
  <div class="post-reward">
      <div>
        <img src="/images/wechatpay.jpg" alt="Jaron Chim 微信">
        <span>微信</span>
      </div>
      <div>
        <img src="/images/alipay.jpg" alt="Jaron Chim 支付宝">
        <span>支付宝</span>
      </div>

  </div>
</div>

          <div class="post-tags">
              <a href="/tags/linux/" rel="tag"># linux</a>
              <a href="/tags/wget/" rel="tag"># wget</a>
              <a href="/tags/elasticsearch/" rel="tag"># elasticsearch</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2018/12/14/linux%E4%B8%8B%E4%BD%BF%E7%94%A8apt-get%E4%B8%8B%E8%BD%BDjdk8/" rel="prev" title="linux下使用apt-get下载jdk8">
                  <i class="fa fa-angle-left"></i> linux下使用apt-get下载jdk8
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2018/12/14/%E5%BF%AB%E9%80%9F%E9%83%A8%E7%BD%B2Kibana-%E5%B9%B6%E9%85%8D%E7%BD%AE%E5%A4%96%E7%BD%91%E5%8F%AF%E4%BB%A5%E8%AE%BF%E9%97%AE/" rel="next" title="快速部署Kibana 并配置外网可以访问">
                  快速部署Kibana 并配置外网可以访问 <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="beian"><a href="https://beian.miit.gov.cn/" rel="noopener" target="_blank">粤ICP备2025405034号-1 </a>
  </div>
  <div class="copyright">
    &copy; 2016 – 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-user"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">Jaron Chim</span>
  </div>
<div class="busuanzi-count">
    <span class="post-meta-item" id="busuanzi_container_site_uv">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-item" id="busuanzi_container_site_pv">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>

    </div>
  </footer>

  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>
  <div class="sidebar-dimmer"></div>
  <a role="button" class="book-mark-link book-mark-link-fixed"></a>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>

</body>
</html>
